import time
# 爬虫最多只能爬20个
from spider.fans_spider import spider_fans_id_list
# api可以多余20个
from weibo_api.fans_api import get_fans_id_list_api
def get_fans_id_list(user_id):
    page = 1
    result = []
    # demo 1页
    while page <= 1:
        try:
            # id_list = spider_fans_id_list(user_id, page)
            id_list = get_fans_id_list_api(user_id, page)
            result += id_list
            page += 1
            if page % 5 == 0:
                print(f"完成第{page}页粉丝id爬取")
        except Exception as e:
            print(f"爬取第{page}页出错，错误信息为{e} 休息5分钟")
            time.sleep(600)
    return result
    
    

